var form;
var table;
var $;
layui.use(['form','table'],function(){
    form = layui.form;
    table=layui.table;
    $=layui.$;


//课程分类下拉菜单
    $.ajax({
        url: "/SyOperationController/selProductCategorySelect",
        type: "get",
        dataType: "json",
        success: function (data) {
            for(var a=0;a<data.data.length;a++){
                $("#category_id").append("<option value='"+data.data[a].category_id+"'>"+data.data[a].categroy_name+"</option>");
            }
            form.render();
        }
    })

});


//商品分类下拉菜单
/*$.ajax({
    url: "/SyOperationController/selProductCategorySelect",
    type: "get",
    dataType: "json",
    success: function (data) {
        var i="<option value=''>请选择商品分类</option>";
        for(var a=0;a<data.data.length;a++){
            i+="<option value='"+data.data[a].category_id+"'>"+data.data[a].categroy_name+"</option>";

        }
        $("#category_id").html(i);
        form.render();
    }
});*/

//确定查询
function selProduct() {
    var productCode=$("input[name='product_code']").val();
    var productName=$("input[name='product_name']").val();
    var currentpriceProduct=$("input[name='currentprice_product']").val()
    var categoryId=$("#category_id option:selected").val();
    var state=$("#product_sate option:selected").val();
    var productLabel=$("input[name='name4']").val();

    parent.$("input[name='productCode1']").val(productCode);
    parent.$("input[name='productName1']").val(productName);
    parent.$("input[name='currentpriceProduct1']").val(currentpriceProduct);
    parent.$("input[name='categoryId1']").val(categoryId);
    parent.$("input[name='state1']").val(state);
    parent.$("input[name='productLabel1']").val(productLabel);

    parent.sousuo();

    //点击检索之后清空父子的输入框
    $("input").val("");
    $(this).find("option:selected").removeAttr("selected")
    parent.$("input").val("");
    parent.$(this).find("option:selected").removeAttr("selected");

    var layer_1=parent.layer_1;
    layer_1.close(layer_1.index);
};


//重置
function chongzhi(){
    $("input").val("");
    $(this).find("option:selected").removeAttr("selected");
}
